import router from "./index";
import NProgress from "nprogress";
import "nprogress/nprogress.css";

NProgress.configure({
  showSpinner: false
});

router.beforeEach((to, from, next) => {
  if (to.matched.length === 0) {
    next({ path: '/404' })
  } else {
    NProgress.start();
    next();
    NProgress.done();
  }

});

router.afterEach((to, from) => {
  NProgress.done();
});
